<template>
	<view class="f16 feedbackSrc">
		<view class="uni-textarea">
			<textarea class="text" focus maxlength="150" :value="FormData.textarea"
				@input="inputChange($event,'textarea')" placeholder-style="color:#bfbdbc;font-size:14px"
				placeholder="期待您的反馈,我们将会不断改进(150字以内)" />
		</view>
		<view class="connect">
			<input class="connect-input" @input="inputChange($event,'connect')" :value="formData.connect"
				placeholder="请留下您的手机号或者邮箱,方便我们及时回复" />
		</view>
		<view><button type="primary" :loading="isLoading" @click="submit">提交</button></view>
	</view>
</template>

<script>
	export default {
		data() {
			return {
				isLoading: false,
				formData: {
					textarea: '',
					connect: ''
				}
			}
		},
		methods: {
			submit() {
				if (this.formData.connect == '' || this.formData.connect.length == 0) {
					uni.showToast({
						title: '请输入反馈内容',
						icon: 'error',
						duration: 850
					});
					return
				}
				if (this.formData.textarea == '' || this.formData.textarea.length == 0) {
					uni.showToast({
						title: '请输入联系方式',
						icon: 'error',
						duration: 850
					});
					return
				}
			},
			inputChange(e, type) {
				const value = e.detail.value
				switch (type) {
					case 'textarea':
						this.textarea = value
						break;
					case 'connect':
						this.connect = value
						break;
				}
			},
			created() {

			}

		},
	}
</script>

<style scoped lang="less">
	.feedbackSrc {
		padding: 10rpx 20rpx;

		.connect {
			margin: 10px 0;
			border-radius: 5px;
			overflow: hidden;
		}

		.connect-input {
			background-color: #fff;
			padding: 25rpx 20rpx;
		}

		.text {
			padding: 15rpx 20rpx;
			background-color: #fff;
			border-radius: 5px;
			box-sizing: border-box;
			line-height: 5px;
			letter-spacing: 2px;
		}
	}
</style>
